﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Windows.Media.Imaging;

namespace Freshome.m.mds
{
    // Major type
    public class Majoraw : Shortype<Rmt.Majoraw>
    {
        public Majoraw(Rmt.Majoraw pm)
            : base(pm)
        {
        }
        public string Name
        {
            get { return this._pm.Name; }
            set
            {
                value = value.Trim();
                if (value.Match(@"^[\S\s]{2,10}$") && this._pm.Name != value)
                {
                    this._pm.Name = value;
                    this.Updated = !Created;
                }
                OnPropertyChanged("Name");
            }
        }
        public override void Refresh(Rmt.Majoraw pm)
        {
            this.Name = pm.Name;
            this.Notes = pm.Notes;
            this.Updated = false;
        }
        public bool IsValid
        {
            get
            {
                return _pm.Name.Match(@"^[\S\s]{2,10}$") && _pm.Notes.Match(@"^[\S\s]{0,50}$");
            }
        }
    }
    public sealed class MeatMaterial : Majoraw
    {
        public MeatMaterial()
            : this(new Rmt.Majoraw { Mid = default(short), Name = string.Empty, Category = Rmt.MajorawCateg.Meat })
        {
            _pm.Notes = string.Empty;
        }
        public MeatMaterial(Rmt.Majoraw pm)
            : base(pm)
        { }
    }
    public sealed class GreenMaterial : Majoraw
    {
        public GreenMaterial()
            : this(new Rmt.Majoraw { Mid = default(short), Name = string.Empty, Category = Rmt.MajorawCateg.Green })
        {
            _pm.Notes = string.Empty;
        }
        public GreenMaterial(Rmt.Majoraw pm)
            : base(pm)
        { }
    }
    public sealed class GrainMaterial : Majoraw
    {
        public GrainMaterial()
            : this(new Rmt.Majoraw { Mid = default(short), Name = string.Empty, Category = Rmt.MajorawCateg.Grain })
        {
            _pm.Notes = string.Empty;
        }
        public GrainMaterial(Rmt.Majoraw pm)
            : base(pm)
        { }
    }
    public sealed class WaterMaterial : Majoraw
    {
        public WaterMaterial()
            : this(new Rmt.Majoraw { Mid = default(short), Name = string.Empty, Category = Rmt.MajorawCateg.Water })
        {
            _pm.Notes = string.Empty;
        }
        public WaterMaterial(Rmt.Majoraw pm)
            : base(pm)
        { }
    }
    public sealed class EggMaterial : Majoraw
    {
        public EggMaterial()
            : this(new Rmt.Majoraw { Mid = default(short), Name = string.Empty, Category = Rmt.MajorawCateg.Egg })
        {
            _pm.Notes = string.Empty;
        }
        public EggMaterial(Rmt.Majoraw pm)
            : base(pm)
        { }
    }
    public sealed class BeanMaterial : Majoraw
    {
        public BeanMaterial()
            : this(new Rmt.Majoraw { Mid = default(short), Name = string.Empty, Category = Rmt.MajorawCateg.Bean })
        {
            _pm.Notes = string.Empty;
        }
        public BeanMaterial(Rmt.Majoraw pm)
            : base(pm)
        { }
    }
    public sealed class MilkMaterial : Majoraw
    {
        public MilkMaterial()
            : this(new Rmt.Majoraw { Mid = default(short), Name = string.Empty, Category = Rmt.MajorawCateg.Milk })
        {
            _pm.Notes = string.Empty;
        }
        public MilkMaterial(Rmt.Majoraw pm)
            : base(pm)
        { }
    }
    public sealed class FruitMaterial : Majoraw
    {
        public FruitMaterial()
            : this(new Rmt.Majoraw { Mid = default(short), Name = string.Empty, Category = Rmt.MajorawCateg.Fruit })
        {
            _pm.Notes = string.Empty;
        }
        public FruitMaterial(Rmt.Majoraw pm)
            : base(pm)
        { }
    }
    public sealed class NutMaterial : Majoraw
    {
        public NutMaterial()
            : this(new Rmt.Majoraw { Mid = default(short), Name = string.Empty, Category = Rmt.MajorawCateg.Nut })
        {
            _pm.Notes = string.Empty;
        }
        public NutMaterial(Rmt.Majoraw pm)
            : base(pm)
        { }
    }
    public sealed class MushroomMaterial : Majoraw
    {
        public MushroomMaterial()
            : this(new Rmt.Majoraw { Mid = default(short), Name = string.Empty, Category = Rmt.MajorawCateg.Mushroom })
        {
            _pm.Notes = string.Empty;
        }
        public MushroomMaterial(Rmt.Majoraw pm)
            : base(pm)
        { }
    }
}
